Zheng Li [Thu, 31 Oct 2013 16:32:56 +0000 (16:32 +0000)]
oxenstored: allow updates regardless of quota
Allow a domain updating existing xenstore keys even if it has already reached
its max entries limit
As updating existing key won't increase the number of entries belonging to a
domain, we should avoid checking the max entries limit prematurely. The patch
addresses this issue in the following functions: write/add, mkdir, setperms.
Signed-off-by: Zheng Li <zheng.li@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:50:03 +0000 (17:50 +0000)]
libxl: ocaml: provide defaults for libxl types
Libxl functions such as libxl_domain_create_new take large structs
of configuration parameters. Often, we would like to use the default
values for many of these parameters.
The struct and keyed-union types in libxl have init functions, which
fill in the defaults for a given type. This commit provides an OCaml
interface to obtain records of defaults by calling the relevant init
function.
These default records can be used as a base to construct your own
records, and to selectively override parameters where needed.
For example, a Domain_create_info record can now be created as follows:
Xenlight.Domain_create_info.({ default ctx () with
ty = Xenlight.DOMAIN_TYPE_PV;
name = Some vm_name;
uuid = vm_uuid;
})
For types with KeyedUnion fields, such as Domain_build_info, a record
with defaults is obtained by specifying the type key:
Rob Hoes [Wed, 6 Nov 2013 17:49:53 +0000 (17:49 +0000)]
libxl: ocaml: use the "string option" type for IDL strings
The libxl IDL is based on C type "char *", and therefore "strings" can
by NULL, or be an actual string. In ocaml, it is common to encode such
things as option types.
Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:49:52 +0000 (17:49 +0000)]
libxl: ocaml: fix the handling of enums in the bindings generator
Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:49:51 +0000 (17:49 +0000)]
libxl: ocaml: add domain_build/create_info/config and events to the bindings.
We now have enough infrastructure in place to do this trivially.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:49:50 +0000 (17:49 +0000)]
libxl: ocaml: make Val_defbool GC-proof
In order to avoid newly created OCaml values from being GC'ed, they must be
registered as roots with the GC, before an iteration of the GC may happen. The
Val_* functions potentially allocate new values on the OCaml heap, and may
trigger an iteration of the OCaml GC.
The way to register a value with the GC is to assign it to a variable declared
with a CAMLparam or CAMLlocal macro, which put the value into a struct that
can be reached from a GC root.
This leads to slightly weird looking C code, but avoids hard to find segfaults.
Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:49:45 +0000 (17:49 +0000)]
libxl: ocaml: switch all functions over to take a context.
Since the context has a logger we can get rid of the logger built into these
bindings and use the xentoollog bindings instead.
The gc is of limited use when most things are freed with libxl_FOO_dispose,
so get rid of that too.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:49:44 +0000 (17:49 +0000)]
libxl: ocaml: allocate a long lived libxl context.
Rather than allocating a new context for every libxl call begin to
switch to a model where a context is allocated by the caller and may
then be used for multiple calls down into the library.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com>
Rob Hoes [Wed, 6 Nov 2013 17:49:43 +0000 (17:49 +0000)]
libxc: ocaml: add simple binding for xentoollog (output only).
These bindings allow ocaml code to receive log message via xentoollog
but do not support injecting messages into xentoollog from ocaml.
Receiving log messages from libx{c,l} and forwarding them to ocaml is
the use case which is needed by the following patches.
Add a simple noddy test case (tools/ocaml/test).
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Rob Hoes <rob.hoes@citrix.com> Acked-by: David Scott <dave.scott@eu.citrix.com>
[ ijc -- dropped the xtl test harness, it failed to link ]
Rob Hoes [Wed, 6 Nov 2013 17:49:41 +0000 (17:49 +0000)]
libxl: ocaml: support for KeyedUnion in the bindings generator.
A KeyedUnion consists of two fields in the containing struct. First an
enum field ("e") used as a descriminator and second a union ("u")
containing potentially anonymous structs associated with each enum
value.
We map the anonymous structs to structs named after the descriminator
field ("e") and the specific enum values. We then declare an ocaml
variant type name e__union mapping each enum value to its associated
struct.
Ian Campbell [Tue, 29 Oct 2013 11:39:50 +0000 (11:39 +0000)]
tools: support system supplied ovmf binary
Debian Jessie at least contains an ovmf package that includes
/usr/share/ovmf/OVMF.fd. It's also possible that user may want to supply
his/her own ovmf binary.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Kelley Nielsen [Mon, 11 Nov 2013 10:27:54 +0000 (02:27 -0800)]
libxl: use macro GCNEW in libxl_qmp.c
The new coding style uses the convenience macro GCNEW as declared in
libxl_internal.h. Substitute an invocation of this macro for its
body at the one place it occurs in libxl_qmp.c.
Suggested-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Kelley Nielsen [Mon, 11 Nov 2013 10:08:58 +0000 (02:08 -0800)]
libxl: use macro CTX in libxl_qmp.c
The new coding style uses the convenience macro CTX as declared in
libxl_internal.h. Substitute an invocation of this macro for its body
at the one place it occurs in libxl_qmp.c.
Suggested-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Kelley Nielsen [Mon, 11 Nov 2013 10:08:57 +0000 (02:08 -0800)]
libxl: add convenience macros to qmp_send() in libxl_qmp.c
Update qmp_send() in libxl_qmp.c to use the new convenience macros
declared in libxl_internal.h. Uses GC_INIT at the top of the function,
and GC_FREE at the exit. Since GC_INIT returns a libxl__gc by reference
and not by value, remove the address operator from the left of the
variable gc where it is passed as a parameter.
Suggested-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Kelley Nielsen [Sun, 10 Nov 2013 03:05:05 +0000 (19:05 -0800)]
libxl: macro LOG() used in place of LIBXL__LOG in libxl_qmp.c
Code cleanup -- no functional changes
Coding style has recently been changed for libxl. The convenience macro
LOG() has been introduced, and it is intended that it calls to the old
macro LIBXL__LOG() be replaced with it. Change 7 occurences of the old
macro (in functions that have a local libxl_gc *gc) to the new one.
Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Jan Beulich [Mon, 11 Nov 2013 10:01:04 +0000 (11:01 +0100)]
x86/idle: reduce contention on ACPI register accesses
Other than when they're located in I/O port space, accessing them when
in MMIO space (currently) implies usage of some sort of global lock: In
-unstable this would be due to the use of vmap(), is older trees the
necessary locking was introduced by 2ee9cbf9 ("ACPI: fix
acpi_os_map_memory()"). This contention was observed to result in Dom0
kernel soft lockups during the loading of the ACPI processor driver
there on systems with very many CPU cores.
There are a couple of things being done for this:
- re-order elements of an if() condition so that the register access
only happens when we really need it
- turn off arbitration disabling only when the first CPU leaves C3
(paralleling how arbitration disabling gets turned on)
- only set the (global) bus master reload flag once (when the first
target CPU gets processed)
Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Jan Beulich [Mon, 11 Nov 2013 10:00:21 +0000 (11:00 +0100)]
x86/Intel: don't probe CPUID faulting on family 0xf CPUs
These are known to not support the feature, so we can save ourselves
from emitting the resulting #GP fault recovery related message (which
might worry people looking at the logs).
Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Liu Jinsong <jinsong.liu@intel.com> Acked-by: Keir Fraser <keir@xen.org>
Jan Beulich [Mon, 11 Nov 2013 08:15:04 +0000 (09:15 +0100)]
nested VMX: VMLANUCH/VMRESUME emulation must check permission first thing
Otherwise uninitialized data may be used, leading to crashes.
This is CVE-2013-4551 / XSA-75.
Reported-and-tested-by: Jeff Zimmerman <Jeff_Zimmerman@McAfee.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-and-tested-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Jan Beulich [Fri, 8 Nov 2013 10:08:32 +0000 (11:08 +0100)]
x86/EFI: make trampoline allocation more flexible
Certain UEFI implementations reserve all memory below 1Mb at boot time,
making it impossible to properly allocate the chunk necessary for the
trampoline. Fall back to simply grabbing a chunk from EfiBootServices*
regions immediately prior to calling ExitBootServices().
Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Kouya Shimura [Fri, 8 Nov 2013 10:07:14 +0000 (11:07 +0100)]
x86/hvm: fix restart of RTC periodic timer with vpt_align=1
The commit 58afa7ef "x86/hvm: Run the RTC periodic timer on a
consistent time series" aligns the RTC periodic timer to the VM's boot time.
However, it's aligned later again to the system time in create_periodic_time()
with vpt_align=1. The next tick might be skipped.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Tim Deegan <tim@xen.org>
Nathan Studer [Wed, 6 Nov 2013 09:21:09 +0000 (10:21 +0100)]
call sched_destroy_domain before cpupool_rm_domain
The domain destruction code, removes a domain from its cpupool
before attempting to destroy its scheduler information. Since
the scheduler framework uses the domain's cpupool information
to decide on which scheduler ops to use, this results in the
the wrong scheduler's destroy domain function being called
when the cpupool scheduler and the initial scheduler are
different.
Correct this by destroying the domain's scheduling information
before removing it from the pool.
Signed-off-by: Nathan Studer <nate.studer@dornerworks.com> Reviewed-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Keir Fraser <keir@xen.org>
David Vrabel [Wed, 6 Nov 2013 09:20:24 +0000 (10:20 +0100)]
evtchn: don't lose pending state if FIFO event array page is missing
When the FIFO-based ABI is in use, if an event is bound when the
corresponding event array page is missing any attempt to set the event
pending will lose the event (because there is nowhere to write the
pending state).
This wasn't initially considered an issue because guests were expected
to only bind events once they had expanded the event array, however:
1. A domain may start with events already bound (by the toolstack).
2. The guest does not know what the port number will be until the
event is bound (it doesn't know how many already bound events there
are), so it does not know how many event array pages are required.
This makes it difficult to expand in advanced (the current Linux
implementation expands after binding for example).
To prevent pending events from being lost because there is no array
page, temporarily store the pending state in evtchn->pending. When an
array page is added, use this state to set the port as pending.
Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Liu Jinsong [Wed, 6 Nov 2013 09:13:20 +0000 (10:13 +0100)]
VMX: flush cache when vmentry back to UC guest
This patch flush cache when vmentry back to UC guest, to prevent
cache polluted by hypervisor access guest memory during UC mode.
The elegant way to do this is, simply add wbinvd just before vmentry.
However, currently wbinvd before vmentry will mysteriously trigger
lapic timer interrupt storm, hung booting stage for 10s ~ 60s. We still
didn't dig out the root cause of interrupt storm, so currently this
patch add flag indicating hypervisor access UC guest memory to prevent
interrupt storm -- though it still leaves aspects un-addressed, i.e.
speculative reads, and multi-vCPU issues, etc.
Whenever the interrupt storm got root caused and fixed, the protection
flag can be removed -- that would be final clean and elegant approach
dealing with cache flushing before vmentry.
This is CVE-2013-2212 / XSA-60.
Suggested-by: Jan Beulich <jbeulich@suse.com> Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Jun Nakajima <jun.nakajima@intel.com>
Liu Jinsong [Wed, 6 Nov 2013 09:12:36 +0000 (10:12 +0100)]
VMX: fix cr0.cd handling
This patch solves XSA-60 security hole:
1. For guest w/o VT-d, and for guest with VT-d but snooped, Xen need
do nothing, since hardware snoop mechanism has ensured cache coherency.
2. For guest with VT-d but non-snooped, cache coherency can not be
guaranteed by h/w snoop, therefore it need emulate UC type to guest:
2.1). if it works w/ Intel EPT, set guest IA32_PAT fields as UC so that
guest memory type are all UC.
2.2). if it works w/ shadow, drop all shadows so that any new ones would
be created on demand w/ UC.
This patch also fix a bug of shadow cr0.cd setting. Current shadow has a
small window between cache flush and TLB invalidation, resulting in possilbe
cache pollution. This patch pause vcpus so that no vcpus context involved
into the window.
This is CVE-2013-2212 / XSA-60.
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jun Nakajima <jun.nakajima@intel.com> Acked-by: Keir Fraser <keir@xen.org>
Liu Jinsong [Wed, 6 Nov 2013 09:12:00 +0000 (10:12 +0100)]
VMX: remove the problematic set_uc_mode logic
XSA-60 security hole comes from the problematic vmx_set_uc_mode.
This patch remove vmx_set_uc_mode logic, which will be replaced by
PAT approach at later patch.
This is CVE-2013-2212 / XSA-60.
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org> Acked-by: Jun Nakajima <jun.nakajima@intel.com>
Liu Jinsong [Wed, 6 Nov 2013 09:11:18 +0000 (10:11 +0100)]
VMX: disable EPT when !cpu_has_vmx_pat
Recently Oracle developers found a Xen security issue as DOS affecting,
named as XSA-60. Please refer http://xenbits.xen.org/xsa/advisory-60.html
Basically it involves how to handle guest cr0.cd setting, which under
some environment it consumes much time resulting in DOS-like behavior.
This is a preparing patch for fixing XSA-60. Later patch will fix XSA-60
via PAT under Intel EPT case, which depends on cpu_has_vmx_pat.
This is CVE-2013-2212 / XSA-60.
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org> Acked-by: Jun Nakajima <jun.nakajima@intel.com>
Roger Pau Monne [Wed, 2 Oct 2013 09:24:25 +0000 (11:24 +0200)]
libxl: make hotplug execution conditional on backend_domid == domid
libxl currently refuses to execute hotplug scripts if the backend
domid of a device is different than LIBXL_TOOLSTACK_DOMID. This will
prevent libxl from executing hotplug scripts when running on a domain
different than LIBXL_TOOLSTACK_DOMID, we should instead check if
backend_domid is different than current domid.
Ian Campbell [Fri, 1 Nov 2013 14:03:11 +0000 (14:03 +0000)]
xen/arm: Blacklist sun7i UARTs
These are in the same page as the UART which is used as the Xen console. We are
not currently smart enough to avoid passing them through to the guest,
accidentally giving the guest access to the Xen console UART.
we blacklist them all, if necessary in the future we can split the list into
two halves and make a per platform decision about which half should be
blacklisted on a given platform depending on which UART is wired up as the
console.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Julien Grall <julien.grall@linaro.org>
Matthew Daley [Fri, 1 Nov 2013 00:33:23 +0000 (13:33 +1300)]
libvchan: tidy up usages of fcntl in select-type sample application
Namely, don't overwrite all the other flags when twiddling O_NONBLOCK,
and add basic error handling.
Coverity-ID: 1055041 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Nathan Studer [Mon, 4 Nov 2013 15:21:11 +0000 (16:21 +0100)]
ARINC653: fix NULL pointer dereference in free_vdata
The ARINC653 scheduler alloc_vdata function does not add the
idle cpu to its internal vcpu_list, but when the free_vdata
function is called, the scheduler attempted to remove the vcpu
from its internal vcpu_list, regardless of whether or not
the vcpu was the idle vcpu. Since the idle vcpu's list field
was never initialized, a NULL pointer was passed to list_del.
When using cpupools, this resulted in a crash when moving a cpu
from an arinc653 scheduler pool.
Signed-off-by: Nathan Studer <nate.studer@dornerworks.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Nathan Studer [Mon, 4 Nov 2013 15:20:33 +0000 (16:20 +0100)]
ARINC653: fix sched_priv corruption in alloc_vdata
The ARINC653 scheduler was directly assigning and manipulating
the sched_priv field of a vcpu in its alloc_vdata function.
When creating a cpu pool, this resulted in the corruption
of the sched_priv field of the vcpu, which was then passed
to the initial scheduler's free_vdata function with
disastrous results.
Signed-off-by: Nathan Studer <nate.studer@dornerworks.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Andrew Cooper [Mon, 4 Nov 2013 13:45:17 +0000 (14:45 +0100)]
x86/ats: Fix parsing of 'ats' command line option
This is really a boolean_param() hidden inside a hand-coded attempt to
replicate boolean_param(), which misses the 'no-' prefix semantics
expected with Xen boolean parameters.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Jan Beulich [Mon, 4 Nov 2013 13:29:24 +0000 (14:29 +0100)]
x86: make sure memory block is RAM before passing to the allocator
Memory blocks outside of the always visible 1:1 mapping range get
passed to the allocator separately (once enough other setup was done).
Skipping non-RAM regions, however, was forgotten in adc5afbf ("x86:
support up to 16Tb").
Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Jan Beulich [Mon, 4 Nov 2013 09:10:04 +0000 (10:10 +0100)]
x86/ACPI/x2APIC: guard against out of range ACPI or APIC IDs
Other than for the legacy APIC, the x2APIC MADT entries have valid
ranges possibly extending beyond what our internal arrays can handle,
and hence we need to guard ourselves against corrupting memory here.
Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Keir Fraser <keir@xen.org>
Matthew Daley [Fri, 1 Nov 2013 00:30:44 +0000 (13:30 +1300)]
libxl: check for xc_domain_shutdown failure in libxl__domain_suspend_common_callback
Coverity-ID: 1055048 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Fri, 1 Nov 2013 00:29:21 +0000 (13:29 +1300)]
libxl: check for xc_domain_max_vcpus failure in libxl__build_pre
Coverity-ID: 1055047 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Fri, 1 Nov 2013 00:27:32 +0000 (13:27 +1300)]
libxc: check for xc_vcpu_setcontext failure in xc_domain_resume_any
Coverity-ID: 1090352 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:42 +0000 (20:51 +1300)]
libxc: don't read uninitialized size value in xc_read_image
This error case can only be triggered by gzread returning 0 (and having
not read anything), so move it there.
Coverity-ID: 1056076 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Coverity-ID: 1056153 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:52:04 +0000 (20:52 +1300)]
xentrace: don't try to close null libxc handle in disable_tbufs
While at it, simplify the function.
Coverity-ID: 1055316 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:52:03 +0000 (20:52 +1300)]
xenctx: correct error check when opening libxc
Coverity-ID: 1054979
Coverity-ID: 1055238 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:52:02 +0000 (20:52 +1300)]
xenctx: only alloc symbol if we are inserting it into the symbol table
...otherwise it's pointless, and will leak.
Coverity-ID: 1055936 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Thu, 31 Oct 2013 03:41:32 +0000 (16:41 +1300)]
libvchan: handle libxc evtchn failures properly in init functions
The reasoning behind this patch is that ctrl->event_port is a uint32_t
(ie. unsigned), so the current checks on it for negative error results,
non-negative port presence etc. are incorrect.
Fix by using evtchn_port_or_error_t in the init functions instead,
adjusting the error handling, and removing the now-unnecessary check
from the close function.
Coverity-ID: 1055609
Coverity-ID: 1055610
Coverity-ID: 1055611 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Thu, 31 Oct 2013 03:02:37 +0000 (16:02 +1300)]
docs: make `xl vm-list` example use verbatim formatting
Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:58 +0000 (20:51 +1300)]
xl: correct references to long-removed function in error messages
Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:57 +0000 (20:51 +1300)]
xl: remove needless infinite-loop construct in create_domain
Use a simple if condition instead.
Coverity-ID: 1056150 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:56 +0000 (20:51 +1300)]
xl: check for restore file open failure in create_domain
...otherwise you get a less helpful error message.
Coverity-ID: 1055569 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:55 +0000 (20:51 +1300)]
xl: libxl_list_vm returns a pointer, not a handle
Coverity-ID: 1054978 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:54 +0000 (20:51 +1300)]
libxl: only close fds which successfully opened in libxl__spawn_local_dm
Coverity-ID: 1055565 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:53 +0000 (20:51 +1300)]
libxl: don't leak memory in libxl__poller_get failure case
Coverity-ID: 1055894 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:51 +0000 (20:51 +1300)]
libxl: correct file open success check in libxl__device_pci_reset
It could, even if only in theory, be fd 0.
Coverity-ID: 1055895 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Matthew Daley [Wed, 30 Oct 2013 07:51:48 +0000 (20:51 +1300)]
libxl: check for transaction abortion failure in libxl_set_memory_target
While at it, correct the error handling of libxl__fill_dom0_memory_info;
at that point there is no transaction to end in any manner.
Coverity-ID: 1055046 Signed-off-by: Matthew Daley <mattjd@gmail.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>